package brovia.logic;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public enum DAL  {
	INSTANCE;
	private DAL() {
		loadSqlDriver();
	}
	private final String sqlConn = "jdbc:sqlserver://localhost:1433;instanceName=sqlexpress;";
	private final String sqlUser = "sql";
	private final String sqlPassword = "Pa$$w0rd";
	private final String sqlDriver = "com.microsoft.sqlserver.jdbc.SQLServerDriver";
	
	public Connection getConnection() throws SQLException {
		Connection con = null;
		try {
			con = DriverManager.getConnection(sqlConn, sqlUser, sqlPassword);
		} catch (SQLException e) {
			throw e;
		}
		return con;
	}
	
	private void loadSqlDriver() {
		try {
			Class.forName(sqlDriver);
		} catch (ClassNotFoundException e) {
			e.printStackTrace();
		}
	}
}
